﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace DimsMapper
{
    public partial class MapsListForm : Form
    {
        int selectMapIndex = -1;

        public MapsListForm(List<string> mapsList)
        {
            InitializeComponent();

            lbMaps.Items.AddRange(mapsList.ToArray());
        }

        private void btnOpen_Click(object sender, EventArgs e)
        {
            selectMapIndex = lbMaps.SelectedIndex;
            this.Hide();
        }

        private void lbMaps_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && lbMaps.SelectedIndex != -1) {
                selectMapIndex = lbMaps.SelectedIndex;
                this.DialogResult = DialogResult.OK;
                this.Hide();
            }
        }

        public int SelectMapsLoad()
        {
            return selectMapIndex;
        }
    }
}
